<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Socket通信系统</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }

        .container {
            background: white;
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.3);
            padding: 40px;
            text-align: center;
            max-width: 600px;
            width: 100%;
        }

        .logo {
            font-size: 48px;
            margin-bottom: 20px;
            color: #3498db;
        }

        h1 {
            color: #2c3e50;
            margin-bottom: 10px;
            font-size: 32px;
        }

        .subtitle {
            color: #7f8c8d;
            margin-bottom: 30px;
            font-size: 18px;
        }

        .status {
            background: #ecf0f1;
            padding: 15px;
            border-radius: 10px;
            margin-bottom: 30px;
        }

        .status-item {
            display: flex;
            justify-content: space-between;
            margin: 10px 0;
            padding: 8px 0;
            border-bottom: 1px solid #bdc3c7;
        }

        .status-item:last-child {
            border-bottom: none;
        }

        .btn-group {
            display: flex;
            gap: 15px;
            justify-content: center;
            flex-wrap: wrap;
        }

        .btn {
            padding: 12px 30px;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            cursor: pointer;
            text-decoration: none;
            display: inline-block;
            transition: all 0.3s ease;
            font-weight: bold;
        }

        .btn-primary {
            background: #3498db;
            color: white;
        }

        .btn-primary:hover {
            background: #2980b9;
            transform: translateY(-2px);
        }

        .btn-success {
            background: #27ae60;
            color: white;
        }

        .btn-success:hover {
            background: #219a52;
            transform: translateY(-2px);
        }

        .btn-info {
            background: #17a2b8;
            color: white;
        }

        .btn-info:hover {
            background: #138496;
            transform: translateY(-2px);
        }

        .server-info {
            margin-top: 30px;
            padding: 15px;
            background: #f8f9fa;
            border-radius: 8px;
            border-left: 4px solid #3498db;
        }

        .features {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 20px;
            margin: 30px 0;
        }

        .feature {
            padding: 20px;
            background: #f8f9fa;
            border-radius: 8px;
            text-align: center;
        }

        .feature-icon {
            font-size: 24px;
            margin-bottom: 10px;
            color: #3498db;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="logo">💬</div>
    <h1>Socket通信系统</h1>
    <p class="subtitle">基于Spring Boot + WebSocket的实时通信平台</p>

    <div class="status">
        <div class="status-item">
            <span>服务器状态:</span>
            <span style="color: #27ae60; font-weight: bold;">运行中</span>
        </div>
        <div class="status-item">
            <span>服务地址:</span>
            <span>localhost:8080</span>
        </div>
        <div class="status-item">
            <span>上下文路径:</span>
            <span>/socket-server</span>
        </div>
        <div class="status-item">
            <span>WebSocket端点:</span>
            <span>/websocket</span>
        </div>
    </div>

    <div class="features">
        <div class="feature">
            <div class="feature-icon">🔗</div>
            <h3>实时连接</h3>
            <p>基于WebSocket的实时双向通信</p>
        </div>
        <div class="feature">
            <div class="feature-icon">👥</div>
            <h3>多用户支持</h3>
            <p>支持多个客户端同时在线聊天</p>
        </div>

    </div>

    <div class="btn-group">
        <a href="/socket-server/chat.html" class="btn btn-primary">进入聊天室</a>
        <a href="/socket-server/api/chat/health" class="btn btn-success">健康检查</a>
        <a href="/socket-server/api/chat/stats" class="btn btn-info">服务器状态</a>
    </div>

    <div class="server-info">
        <h3>连接信息</h3>
        <p><strong>WebSocket URL:</strong> ws://localhost:8080/socket-server/websocket</p>
        <p><strong>API 基础路径:</strong> http://localhost:8080/socket-server/api</p>
    </div>
</div>

<script>
    // 检查服务器状态
    async function checkServerStatus() {
        try {
            const response = await fetch('/socket-server/api/chat/health');
            if (response.ok) {
                console.log('服务器状态正常');
            }
        } catch (error) {
            console.log('服务器状态检查失败:', error);
        }
    }

    // 页面加载时检查状态
    window.addEventListener('load', checkServerStatus);
</script>
</body>
</html>